"""
@name : ip存储
@author : shiyaling
@projectname : xsfh
"""
import random
fp = open("ips.txt","a+")
i = 0
while i <= 120000:
    a = random.randint(0,254)
    fp.write(f"172.25.254.{a}\n")
    i += 1
with open("ips.txt","r") as fp:
    ipdict = dict()
    for line in fp:
        ip = line.strip()
        if ip in ipdict:
            ipdict[ip] += 1
        else:
            ipdict[ip] = 1

sorted_ip = sorted(ipdict.items(),key=lambda ipdict:ipdict[1],reverse=True)[:10]
print(sorted_ip)











